package v1

import "gin-vben-admin/internal/constant"

type SysDeptCreateReq struct {
	AuthId int64 `json:"-" binding:"required"`

	DeptName string          `form:"dept_name" json:"dept_name" binding:"required,min=2,max=30" comment:"部门名称"` //部门名称
	ParentId int64           `form:"parent_id" json:"parent_id" binding:"omitempty" comment:"上级部门"`             //上级部门
	Sort     int             `form:"sort" json:"sort" binding:"omitempty" comment:"排序"`                         //排序
	Status   constant.Status `form:"status" json:"status" binding:"required,oneof=1 2" comment:"状态"`            //状态 1启用，2禁用
	Remark   string          `form:"remark" json:"remark" binding:"omitempty,max=255" comment:"备注"`             //备注
}

type SysDeptListReq struct {
	DeptId int64 `form:"dept_id" form:"dept_id" binding:"omitempty"` //部门id
}

type SysDeptUpdateReq struct {
	AuthId int64 `json:"-" binding:"required"`

	DeptId   int64           `form:"dept_id" json:"dept_id" binding:"required,gt=0" comment:"部门id"`             //部门id
	DeptName string          `form:"dept_name" json:"dept_name" binding:"required,min=2,max=30" comment:"部门名称"` //部门名称
	ParentId int64           `form:"parent_id" json:"parent_id" binding:"omitempty" comment:"上级部门"`             //上级部门
	Sort     int             `form:"sort" json:"sort" binding:"omitempty" comment:"排序"`                         //排序
	Status   constant.Status `form:"status" json:"status" binding:"required,oneof=1 2" comment:"状态"`            //状态 1启用，2禁用
	Remark   string          `form:"remark" json:"remark" binding:"omitempty,max=255" comment:"备注"`             //备注
}

//
//func (c *DeptCreateReq) Generate(ctx http.Context) *models.SysDept {
//	model := &models.SysDept{}
//	model.DeptName = c.DeptName
//	model.Sort = c.Sort
//	model.Status = c.Status
//	model.ParentId = c.ParentId
//	model.Remark = c.Remark
//	authId := token.AuthId(ctx)
//	model.CreateBy = authId
//	model.UpdateBy = authId
//	return model
//}
//
//func (c *DeptUpdateReq) Generate(model *models.SysDept, ctx http.Context) *models.SysDept {
//	model.DeptName = c.DeptName
//	model.Sort = c.Sort
//	model.Status = c.Status
//	model.ParentId = c.ParentId
//	model.Remark = c.Remark
//	authId := token.AuthId(ctx)
//	model.UpdateBy = authId
//	return model
//}
